<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* 
        100内的整数求和
        1+2+3+4+5+6+.....+100
        sum=1+2
        sum +3
        sum +4...
        1.遍历1-100
        2.声明一个变量保存求和
        3.累加
        */
       let sum = null;
       for (let i=0; i<= 100; i++){
        //console.log(i);
        sum = sum + i;
    }
    console.log(sum);
    console.log('----------100以内的整数倒着遍历求和-------------');
    </script>
</body>
</html>